﻿namespace _01.MobileDevice
{
    using System;

    public class Display
    {
        private double? size;
        private int? numberOfColors;

        public Display(double? size, int? numberOfColors)
        {
            this.Size = size;
            this.NumberOfColors = numberOfColors;
        }

        public double? Size
        {
            get
            {
                return this.size;
            }

            set
            {
                if (value < 0 || 99 < value)
                {
                    throw new ArgumentOutOfRangeException();
                }

                this.size = value;
            }
        }

        public int? NumberOfColors
        {
            get
            {
                return this.numberOfColors;
            }

            set
            {
                if (value <= 0)
                {
                    throw new ArgumentOutOfRangeException("The value must be positive number.");
                }

                this.numberOfColors = value;
            }
        }

        public override string ToString()
        {
            return string.Format("Size: {0}\", Number Of Colors: {1}", this.size, this.numberOfColors);
        }
    }
}
